<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		
		<title>河南工学院</title>

		<meta name="description" content="User login page">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/login.css">
	</head>
	
<div id="wrap">

  <div id="header">
    <div class="topbox">
      <div class="logo"><img src="${pageContext.request.contextPath }/images/logo.png" width='200px'></div>
    </div>
  </div>
  
  <div id="mainer">
  
    <div class="login_main">
    
      <div class="login_img"></div>
      <div class="login_box" style="width:390px; height:450px;padding-left:60px">
        <div class="login_tit">用户登录</div>
        
          <form method="post" action="${pageContext.request.contextPath }/client/loginAction.do" id="form1">
            <div class="item">       
                <input name="cliName" type="text" id="txtUserName" class="input input1" placeholder="账号">
                <i class="input-username"></i>
            </div>
            <div class="item item2">
                <input name="cliPassword" type="password" id="txtPassword" class="input input2" placeholder="密码">
                <i class="input-password"></i>
            </div>
             <p style='color:red' id="errorMsg">
				${errorMsg } 
          	</p>
            <div class="item">
               
            <input type="button" onclick="login()" name="btnLogin" value="登录" id="btnLogin" class="btn">
			<input style='margin-top:10px' type="button" name="btnLogin" value="注册" id="btnRegister" class="btn">
			</a>
            </div>
            
          </form>
          
         
      </div>
      
    </div>
  
  </div>
  
  <div id="footer">
    <div class="footbox"><a href="">北京打造前程集团</a></div>
  </div>

</div>
</body>
	<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-2.1.4.min.js"></script>
	<script type="text/javascript">
		function login(){
			console.log("this is login");
			var cliName = $("#txtUserName").val();
			var cliPassword = $("#txtPassword").val();
			$.ajax({
				url:"${pageContext.request.contextPath }/user/shiro/login",
				type:"POST",
				data:{"phone":cliName,"code":cliPassword},
				success:function(data){
					//取JSON串的值
					console.log(data.msg);
					console.log(data.suc);
					console.log(data.result);
					if(data.suc == true){
						window.location.href = "${pageContext.request.contextPath }/static/page/success.jsp";
					}
					else{
						$("#errorMsg").html("账号或密码错误");
					}
					
				},
				dataType:"json"
			});

		}
	</script>
	
	
</html>

